import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);

const store = new Vuex.Store({
    state: {
        TypeMessage: {}, //推送数据 倒计时，开奖信息
        Forecast: {}, //计划推荐-计划组号-数据列表
        lottery_id:'1', //彩种Id 默认为1;
        CaiPiaoType: 'ssc',//彩票类型
        CaiPiaoLabel: '重庆时时彩', //彩票名称
        tabsName: '', //Tab选中名
        tabsId:'', //Tab选中Id
        leftMenu:{}, //左侧选中菜单名
        chartMenu:{}, //走势图表菜单
        indexleftinfo: {}, //计划推荐选中侧边栏缓存信息
        leftrecommend: [], //计划推荐左侧菜单判断选码
        leftTaba: {},  //左侧菜单栏选中的一级菜单
        leftMoreMenu:[], //冷热分析左侧菜单
        userInfo:{ // 当前登录用户信息
        },
        //======聊天室相关数据==========// 
        toUserInfo:{ //打开窗体的用户信息
            id:'',
            name:'',
            group_id:'',
        },
        msgUserList:[ //消息好友列表
        ],
        userList:{ //好友列表
        },
        msgList:[ //历史消息，即窗体内消息展示
        ],
        membershiplist:{ //会员列表
        },
        liststatus:{ //会员列表
            parent_id:'',
            login_status:'',
        }
    },
    mutations: {
        getTypeMessage(state,TypeMessage){  //设置推送数据 倒计时，开奖信息
            state.TypeMessage = TypeMessage
        },
        getCaiPiaoType(state,type) { //设置彩种类型
            state.CaiPiaoType = type;
        },
        getCaiPiaoID(state,value){    //设置彩票IDy
            state.lottery_id = value;  
        },
        getSecondTabsName(state,tabsName){ //首页IndexTab菜单点击触发
            state.tabsName = tabsName;
        },
        setLeftMenuName(state,leftMenu){ //左侧菜单点击触发
            state.leftMenu = leftMenu;
        },
        setChartMenuName(state,leftMenu){ //走势图表左侧菜单点击触发
            state.chartMenu = leftMenu;
        },
        setLeftcache(state,indexleftinfo){ //计划推荐左侧菜单点击缓存
            state.indexleftinfo = indexleftinfo;
        },
        setrecommend(state,leftrecommend){ //计划推荐左侧菜单判断选码
            state.leftrecommend = leftrecommend;
        },
        setLeftTaba(state,leftTaba){ //计划推荐选中左侧一级菜单
            state.leftTaba = leftTaba;
        },
        getLeftMoreMenu(state,leftMoreMenu){   //冷热分析左侧菜单
            state.leftMoreMenu = leftMoreMenu;
        },
        setTabsId(state,tabsId){ //设置TabsId
            state.tabsId = tabsId;
        },
        setToUserInfo(state,toUserInfo){ // 设置当前聊天用户信息
            state.toUserInfo = toUserInfo;
        },
        setMsgUserList(state,msgUserList){ //设置消息列表
            state.msgUserList = msgUserList;
        },
        setUserList(state,userList){ //设置好友列表
            state.userList = userList;
        },
        setMsgList(state,msg){ //新增一条消息
            state.msgList.push(msg);
        },
        setAllMsgList(state,msg){ //渲染历史消息
                state.msgList = msg;
        },
        setUserInfo(state,userInfo){ //存入用户信息
            state.userInfo = userInfo;
        },
        setMembershiplist(state,data){ //存入会员列表数据
            state.membershiplist = data;
        },
        setListstatusParent(state,parent_id){ //上级id
            state.liststatus.parent_id = parent_id;
        },
        setListstatusLogin(state,login_status){ //登陆状态筛选
            state.liststatus.login_status = login_status;
        },
        setAllUnRead(state,unreadnum){
            state.userInfo.un_read_num = unreadnum;
        },
        setAnnouncement(state,announcement){ //是否开启语音播报
            state.userInfo.announcement = announcement;
        },
        setBalance(state,balance){ //修改余额
            state.userInfo.balance = balance;
        },
        setCaiPiaoLabel(state,label){ //修改彩票名称
            state.CaiPiaoLabel = label;
        }
    },
    getters:{
        getUserInfo(state){ //获取用户相关数据
            return state.userInfo;
        },
        getToUserInfo(state){ //获取打开窗体用户数据
            return state.toUserInfo;
        },
        getMsgUserList(state){ //获取消息好友列表
            return state.msgUserList;
        },
        getUserList(state){ //获取好友列表
            return state.userList;
        },
        getMsgList(state){ //获取消息列表
            return state.msgList;
        },
        group_unRead(state){
            return state;
        },
        getMembershiplist(state){ //获取会员列表
            return state.membershiplist;
        },
        getAllUnRead(state){ //获取总的未读条数
            return state.userInfo.un_read_num;
        },
        getCaiPiaoLabel(state){ //获取彩票名称
            return state.CaiPiaoLabel;
        }
    }
})

export default store;
